<?php
require_once ('global.php');
if($_POST['action']=='loginz'){
$userinfo=Dga('user'," user = '".trim($_POST[username])."' and psw = '".md5($_POST[password])."' and status = '0' and del != '1' ");
if ( $userinfo){
    $_SESSION['LG']=($_POST[LG]=='bg')?"zh":$_POST[LG];
	$_SESSION['LG']==''&&$_SESSION['LG']='zh';
    $_SESSION['XS']=$_POST[LG];
    $_SESSION[logined] = 1;
    $_SESSION[userinfo] = $userinfo;
	if($_SESSION[userinfo][rcfg]!='S'){
	$rcfg=Dga('rcfg'," id= '".$_SESSION[userinfo]['rightid']."' and del != '1' ");
	if($rcfg){
		$rcfg=json_decode($rcfg[rcfg],true);
		$_SESSION['myright']=$rcfg;
		}else{
	 echo '{success:true,msg:\'权限组发生错误！请联系管理员重新给你授权\'}';
	 exit;
		}
	}
	 echo '{success:true,msg:\'ok\'}';
  } else{
 echo '{success:true,msg:\'帐户或密码错误\'}';
  }
}

?>